/**
 * @fileOverview Special Character plugin
 */
VED.plugins.add( 'specialchar', {
   // List of available localizations.
   availableLangs: { en:1,ru:1 },
   lang: 'ru,en', // %REMOVE_LINE_CORE%
   requires: 'dialog',
   icons: 'specialchar', // %REMOVE_LINE_CORE%
   hidpi: true, // %REMOVE_LINE_CORE%
   init: function( editor ) {
      var pluginName = 'specialchar',
         plugin = this;

      // Register the dialog.
      VED.dialog.add( pluginName, this.path + 'dialogs/specialchar.js' );

      editor.addCommand( pluginName, {
         exec: function() {
            var langCode = editor.langCode;
            langCode =
               plugin.availableLangs[ langCode ] ? langCode :
               plugin.availableLangs[ langCode.replace( /-.*/, '' ) ] ? langCode.replace( /-.*/, '' ) :
               'en';

            // VED.scriptLoader.load( VED.getUrl( plugin.path + 'dialogs/lang/' + langCode + '.js' ), function() {
               VED.tools.extend( editor.lang.specialchar, plugin.langEntries[ langCode ] );
               editor.openDialog( pluginName );
            // });
         },
         modes: { wysiwyg:1 },
         canUndo: false
      });

      // Register the toolbar button.
      editor.ui.addButton && editor.ui.addButton( 'SpecialChar', {
         label: editor.lang.specialchar.toolbar,
         command: pluginName,
         toolbar: 'insert,50'
      });
   }
});

/**
 * The list of special characters visible in the "Special Character" dialog window.
 *
 *    config.specialChars = [ '&quot;', '&rsquo;', [ '&custom;', 'Custom label' ] ];
 *    config.specialChars = config.specialChars.concat( [ '&quot;', [ '&rsquo;', 'Custom label' ] ] );
 *
 * @cfg
 * @member VED.config
 */
/*
VED.config.specialChars = [
   '!', '&quot;', '#', '$', '%', '&amp;', "'", '(', ')', '*', '+', '-', '.', '/',
   '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
   '&lt;', '=', '&gt;', '?', '@',
   'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
   'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
   '[', ']', '^', '_', '`',
   'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
   'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
   '{', '|', '}', '~',
   "&euro;", "&lsquo;", "&rsquo;", "&ldquo;", "&rdquo;", "&ndash;", "&mdash;", "&iexcl;", "&cent;", "&pound;", "&curren;", "&yen;", "&brvbar;", "&sect;", "&uml;", "&copy;", "&ordf;", "&laquo;", "&not;", "&reg;", "&macr;", "&deg;", "&sup2;", "&sup3;", "&acute;", "&micro;", "&para;", "&middot;", "&cedil;", "&sup1;", "&ordm;", "&raquo;", "&frac14;", "&frac12;", "&frac34;", "&iquest;", "&Agrave;", "&Aacute;", "&Acirc;", "&Atilde;", "&Auml;", "&Aring;", "&AElig;", "&Ccedil;", "&Egrave;", "&Eacute;", "&Ecirc;", "&Euml;", "&Igrave;", "&Iacute;", "&Icirc;", "&Iuml;", "&ETH;", "&Ntilde;", "&Ograve;", "&Oacute;", "&Ocirc;", "&Otilde;", "&Ouml;", "&times;", "&Oslash;", "&Ugrave;", "&Uacute;", "&Ucirc;", "&Uuml;", "&Yacute;", "&THORN;", "&szlig;", "&agrave;", "&aacute;", "&acirc;", "&atilde;", "&auml;", "&aring;", "&aelig;", "&ccedil;", "&egrave;", "&eacute;", "&ecirc;", "&euml;", "&igrave;", "&iacute;", "&icirc;", "&iuml;", "&eth;", "&ntilde;", "&ograve;", "&oacute;", "&ocirc;", "&otilde;", "&ouml;", "&divide;", "&oslash;", "&ugrave;", "&uacute;", "&ucirc;", "&uuml;", "&yacute;", "&thorn;", "&yuml;", "&OElig;", "&oelig;", "&#372;", "&#374", "&#373", "&#375;", "&sbquo;", "&#8219;", "&bdquo;", "&hellip;", "&trade;", "&#9658;", "&bull;", "&rarr;", "&rArr;", "&hArr;", "&diams;", "&asymp;"
];
*/
VED.config.specialChars = [
	['&nbsp;',    'no-break space'],
	['&amp;',     'ampersand'],
	['&quot;',    'quotation mark'],
// finance
	['&cent;',    'cent sign'],
	['&euro;',    'euro sign'],
	['&pound;',   'pound sign'],
	['&yen;',     'yen sign'],
// signs
	['&copy;',    'copyright sign'],
	['&reg;',     'registered sign'],
	['&trade;',   'trade mark sign'],
	['&permil;',  'per mille sign'],
	['&micro;',   'micro sign'],
	['&middot;',  'middle dot'],
	['&bull;',    'bullet'],
	['&hellip;',  'three dot leader'],
	['&prime;',   'minutes / feet'],
	['&Prime;',   'seconds / inches'],
	['&sect;',    'section sign'],
	['&para;',    'paragraph sign'],
	['&szlig;',   'sharp s / ess-zed'],
// quotations
	['&lsaquo;',  'single left-pointing angle quotation mark'],
	['&rsaquo;',  'single right-pointing angle quotation mark'],
	['&laquo;',   'left pointing guillemet'],
	['&raquo;',   'right pointing guillemet'],
	['&lsquo;',   'left single quotation mark'],
	['&rsquo;',   'right single quotation mark'],
	['&ldquo;',   'left double quotation mark'],
	['&rdquo;',   'right double quotation mark'],
	['&sbquo;',   'single low-9 quotation mark'],
	['&bdquo;',   'double low-9 quotation mark'],
	['&lt;',      'less-than sign'],
	['&gt;',      'greater-than sign'],
	['&le;',      'less-than or equal to'],
	['&ge;',      'greater-than or equal to'],
	['&ndash;',   'en dash'],
	['&mdash;',   'em dash'],
	['&macr;',    'macron'],
	['&oline;',   'overline'],
	['&curren;',  'currency sign'],
	['&brvbar;',  'broken bar'],
	['&uml;',     'diaeresis'],
	['&iexcl;',   'inverted exclamation mark'],
	['&iquest;',  'turned question mark'],
	['&circ;',    'circumflex accent'],
	['&tilde;',   'small tilde'],
	['&deg;',     'degree sign'],
	['&minus;',   'minus sign'],
	['&plusmn;',  'plus-minus sign'],
	['&divide;',  'division sign'],
	['&frasl;',   'fraction slash'],
	['&times;',   'multiplication sign'],
	['&sup1;',    'superscript one'],
	['&sup2;',    'superscript two'],
	['&sup3;',    'superscript three'],
	['&frac14;',  'fraction one quarter'],
	['&frac12;',  'fraction one half'],
	['&frac34;',  'fraction three quarters'],
// math / logical
	['&fnof;',    'function / florin'],
	['&int;',     'integral'],
	['&sum;',     'n-ary sumation'],
	['&infin;',   'infinity'],
	['&radic;',   'square root'],
	['&sim;',     'similar to'],
	['&cong;',    'approximately equal to'],
	['&asymp;',   'almost equal to'],
	['&ne;',      'not equal to'],
	['&equiv;',   'identical to'],
	['&isin;',    'element of'],
	['&notin;',   'not an element of'],
	['&ni;',      'contains as member'],
	['&prod;',    'n-ary product'],
	['&and;',     'logical and'],
	['&or;',      'logical or'],
	['&not;',     'not sign'],
	['&cap;',     'intersection'],
	['&cup;',     'union'],
	['&part;',    'partial differential'],
	['&forall;',  'for all'],
	['&exist;',   'there exists'],
	['&empty;',   'diameter'],
	['&nabla;',   'backward difference'],
	['&lowast;',  'asterisk operator'],
	['&prop;',    'proportional to'],
	['&ang;',     'angle'],
// undefined
	['&acute;',   'acute accent'],
	['&cedil;',   'cedilla'],
	['&ordf;',    'feminine ordinal indicator'],
	['&ordm;',    'masculine ordinal indicator'],
	['&dagger;',  'dagger'],
	['&Dagger;',  'double dagger'],
// alphabetical s
	['&Agrave;',  'A - grave'],
	['&Aacute;',  'A - acute'],
	['&Acirc;',   'A - circumflex'],
	['&Atilde;',  'A - tilde'],
	['&Auml;',    'A - diaeresis'],
	['&Aring;',   'A - ring above'],
	['&AElig;',   'ligature AE'],
	['&Ccedil;',  'C - cedilla'],
	['&Egrave;',  'E - grave'],
	['&Eacute;',  'E - acute'],
	['&Ecirc;',   'E - circumflex'],
	['&Euml;',    'E - diaeresis'],
	['&Igrave;',  'I - grave'],
	['&Iacute;',  'I - acute'],
	['&Icirc;',   'I - circumflex'],
	['&Iuml;',    'I - diaeresis'],
	['&ETH;',     'ETH'],
	['&Ntilde;',  'N - tilde'],
	['&Ograve;',  'O - grave'],
	['&Oacute;',  'O - acute'],
	['&Ocirc;',   'O - circumflex'],
	['&Otilde;',  'O - tilde'],
	['&Ouml;',    'O - diaeresis'],
	['&Oslash;',  'O - slash'],
	['&OElig;',   'ligature OE'],
	['&Scaron;',  'S - caron'],
	['&Ugrave;',  'U - grave'],
	['&Uacute;',  'U - acute'],
	['&Ucirc;',   'U - circumflex'],
	['&Uuml;',    'U - diaeresis'],
	['&Yacute;',  'Y - acute'],
	['&Yuml;',    'Y - diaeresis'],
	['&THORN;',   'THORN'],
	['&agrave;',  'a - grave'],
	['&aacute;',  'a - acute'],
	['&acirc;',   'a - circumflex'],
	['&atilde;',  'a - tilde'],
	['&auml;',    'a - diaeresis'],
	['&aring;',   'a - ring above'],
	['&aelig;',   'ligature ae'],
	['&ccedil;',  'c - cedilla'],
	['&egrave;',  'e - grave'],
	['&eacute;',  'e - acute'],
	['&ecirc;',   'e - circumflex'],
	['&euml;',    'e - diaeresis'],
	['&igrave;',  'i - grave'],
	['&iacute;',  'i - acute'],
	['&icirc;',   'i - circumflex'],
	['&iuml;',    'i - diaeresis'],
	['&eth;',     'eth'],
	['&ntilde;',  'n - tilde'],
	['&ograve;',  'o - grave'],
	['&oacute;',  'o - acute'],
	['&ocirc;',   'o - circumflex'],
	['&otilde;',  'o - tilde'],
	['&ouml;',    'o - diaeresis'],
	['&oslash;',  'o slash'],
	['&oelig;',   'ligature oe'],
	['&scaron;',  's - caron'],
	['&ugrave;',  'u - grave'],
	['&uacute;',  'u - acute'],
	['&ucirc;',   'u - circumflex'],
	['&uuml;',    'u - diaeresis'],
	['&yacute;',  'y - acute'],
	['&thorn;',   'thorn'],
	['&yuml;',    'y - diaeresis'],
   ['&Alpha;',   'Alpha'],
	['&Beta;',    'Beta'],
	['&Gamma;',   'Gamma'],
	['&Delta;',   'Delta'],
	['&Epsilon;', 'Epsilon'],
	['&Zeta;',    'Zeta'],
	['&Eta;',     'Eta'],
	['&Theta;',   'Theta'],
	['&Iota;',    'Iota'],
	['&Kappa;',   'Kappa'],
	['&Lambda;',  'Lambda'],
	['&Mu;',      'Mu'],
	['&Nu;',      'Nu'],
	['&Xi;',      'Xi'],
	['&Omicron;', 'Omicron'],
	['&Pi;',      'Pi'],
	['&Rho;',     'Rho'],
	['&Sigma;',   'Sigma'],
	['&Tau;',     'Tau'],
	['&Upsilon;', 'Upsilon'],
	['&Phi;',     'Phi'],
	['&Chi;',     'Chi'],
	['&Psi;',     'Psi'],
	['&Omega;',   'Omega'],
	['&alpha;',   'alpha'],
	['&beta;',    'beta'],
	['&gamma;',   'gamma'],
	['&delta;',   'delta'],
	['&epsilon;', 'epsilon'],
	['&zeta;',    'zeta'],
	['&eta;',     'eta'],
	['&theta;',   'theta'],
	['&iota;',    'iota'],
	['&kappa;',   'kappa'],
	['&lambda;',  'lambda'],
	['&mu;',      'mu'],
	['&nu;',      'nu'],
	['&xi;',      'xi'],
	['&omicron;', 'omicron'],
	['&pi;',      'pi'],
	['&rho;',     'rho'],
	['&sigmaf;',  'final sigma'],
	['&sigma;',   'sigma'],
	['&tau;',     'tau'],
	['&upsilon;', 'upsilon'],
	['&phi;',     'phi'],
	['&chi;',     'chi'],
	['&psi;',     'psi'],
	['&omega;',   'omega'],
// symbols
	['&alefsym;', 'alef symbol'],
	['&piv;',     'pi symbol'],
	['&real;',    'real part symbol'],
	['&thetasym;','theta symbol'],
	['&upsih;',   'upsilon - hook symbol'],
	['&weierp;',  'Weierstrass p'],
	['&image;',   'imaginary part'],
// arrows
	['&larr;',    'leftwards arrow'],
	['&uarr;',    'upwards arrow'],
	['&rarr;',    'rightwards arrow'],
	['&darr;',    'downwards arrow'],
	['&harr;',    'left right arrow'],
	['&crarr;',   'carriage return'],
	['&lArr;',    'leftwards double arrow'],
	['&uArr;',    'upwards double arrow'],
	['&rArr;',    'rightwards double arrow'],
	['&dArr;',    'downwards double arrow'],
	['&hArr;',    'left right double arrow'],
	['&there4;',  'therefore'],
	['&sub;',     'subset of'],
	['&sup;',     'superset of'],
	['&nsub;',    'not a subset of'],
	['&sube;',    'subset of or equal to'],
	['&supe;',    'superset of or equal to'],
	['&oplus;',   'circled plus'],
	['&otimes;',  'circled times'],
	['&perp;',    'perpendicular'],
	['&sdot;',    'dot operator'],
	['&lceil;',   'left ceiling'],
	['&rceil;',   'right ceiling'],
	['&lfloor;',  'left floor'],
	['&rfloor;',  'right floor'],
	['&lang;',    'left-pointing angle bracket'],
	['&rang;',    'right-pointing angle bracket'],
	['&loz;',     'lozenge'],
	['&spades;',  'black spade suit'],
	['&clubs;',   'black club suit'],
	['&hearts;',  'black heart suit'],
	['&diams;',   'black diamond suit']
];






